package com.example.springboot.service.imp;

import com.example.springboot.bean.ProductRecord;
import com.example.springboot.service.CashierDeskService;
import com.example.springboot.service.PurchaseBookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by tang on 2018/3/9.
 */
@Service
public class CashiserDeskServiceImpl implements CashierDeskService {
    @Autowired
    PurchaseBookService purchaseBookService;

    @Transactional
    @Override
    public void checkOut(List<ProductRecord> productRecordList, String customerName) {
        for (ProductRecord productRecord : productRecordList) {
            purchaseBookService.buyBook(productRecord, customerName);
        }
    }
}
